class Module
  @@docs = Hash.new(nil)
  def doc(str)
    @@docs[self.name] = str
  end

  def Module::doc(aClass)
    # If we're passed a class or module, convert to string
    # ('<=' for classes checks for same class or subtype)
    aClass = aClass.name if (aClass.kind_of?(Module))
    @@docs[aClass] || "No documentation for #{aClass}"
  end
end

class CV
  doc <<-edoc
     hv(dodaicanh) =>Tinh chu vi hinh vuong
     ht(dodaibankinh) => Tinh chu vi hinh tron
     hcn(dodaichieudai,dodaichieurong) => Tinh chu vi hinh chu nhat
   edoc
  # .. rest of class
  
  def hv(a)
     4*a
   end
   def hcn(a,b)
     2*(a+b)
   end
   def ht(r)
     2*r*3.1415
   end
end

module DTich
  doc <<-edoc
    hv(dodaicanh) =>Tinh dien tich hinh vuong
    ht(dodaibankinh) => Tinh dien tich hinh tron
    hcn(dodaichieudai,dodaichieurong) => Tinh dien tich hinh chu nhat
  edoc
  # rest of module
  class DT
    def hv(a)
        a*a
      end
      def hcn(a,b)
        a*b
      end
      def ht(r)
        r*r*3.1415
      end
end
    
end
=begin
puts Module::doc(CV)
puts Module::doc(DT)
=end